package com.loy.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;


@Component
public class UserService {

    @Autowired
    private OrderService orderService;

    public void test1(){
        System.out.println(orderService);
    }


    /**
     * 1. 我们还可以这样，顶一个一个事件监听器
     *      在spring中，会将这个方法包装成为一个 ApplicationListener 
     * @param event
     */
    @EventListener
    public void a(ApplicationEvent event){
        System.out.println(event);
    }
}
